package com.renge.eduservice.controller.homepage;

import com.renge.commonutils.R;
import com.renge.eduservice.entity.EduCourse;
import com.renge.eduservice.entity.EduTeacher;
import com.renge.eduservice.service.EduCourseService;
import com.renge.eduservice.service.EduTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2021-05-17
 */
@Api(description="首页推荐管理")
@RestController
@CrossOrigin
@RequestMapping("/eduservice/edu-index")
public class IndexFrontController {
    @Autowired
    private EduTeacherService eduTeacherService;
    @Autowired
    private EduCourseService eduCourseService;

    @ApiOperation(value = "查询精品课程限制八个")
    @GetMapping("/course")
    public R IndexfindCourse(){
       List<EduCourse>courseList= eduCourseService.IndexfindCourse();
       return R.ok().data("courseList",courseList);
    }
    @ApiOperation(value = "查询热门老师4个")
    @GetMapping("/teacher")
    public R Indexfindteacher(){
       List<EduTeacher> teacherList=eduTeacherService.Indexfindteacher();
        return R.ok().data("teacherList",teacherList);
    }
}
